package com.rgs.base.core.util.excel;


import com.rgs.base.core.util.excel.bo.ImportFileErrorBO;
import lombok.Setter;

import java.io.File;
import java.util.List;
import java.util.function.Function;

/**
 * @author Ren Gaoshuai
 * @date 2022-03-08 15:45
 **/
@Setter
public class DefaultAnalysisExcelListener<D, T>
        extends AbstractAnalysisExcelListener<D, T> {
    private Function<List<D>, List<ImportFileErrorBO>> saveDataFunction;
    private Function<List<T>, List<D>> mapperFunction;


    public DefaultAnalysisExcelListener(File errFileTemp, String titleName) {
        super(errFileTemp, titleName);
    }

    @Override
    protected List<ImportFileErrorBO> saveData(List<D> tList) {
        return saveDataFunction.apply(tList);
    }

    @Override
    protected List<D> mapper(List<T> ts) {
        return mapperFunction.apply(ts);
    }
}
